import service from '@/utils/request'
//  用户登录
export const login = (data) => {
    return service({
        url: '/users/login',
        method: 'post',
        data: data
    })
}

//  获取验证码
export const captcha = (data) => {
    return service({
        url: '/base/captcha',
        method: 'post',
        data: data
    })
}

//  用户注册
export const save = (data) => {
    return service({
        url: '/users/save',
        method: 'post',
        data: data
    })
}

//  修改密码
export const changePassword = (data) => {
    return service({
        url: '/users/changePassword',
        method: 'post',
        data: data
    })
}


//  分页获取用户列表
export const getUserList = (params) => {
    return service({
        url: '/users/page',
        method: 'get',
        params
    })
}


//  设置用户权限
export const setUserAuthority = (data) => {
    return service({
        url: '/user/setUserAuthority',
        method: 'post',
        data: data
    })
}


//  删除用户
export const deleteUser = (id) => {
    return service({
        url: `/users/delete/${id}`,
        method: 'delete'
    })
}


//  设置用户信息
export const setUserInfo = (data) => {
    return service({
        url: '/users/edit',
        method: 'put',
        data: data
    })
}


//  设置用户信息
export const setSelfInfo = (data) => {
    return service({
        url: '/user/edit',
        method: 'put',
        data: data
    })
}


//  设置用户权限
export const setUserAuthorities = (data) => {
    return service({
        url: '/roles/setAuth',
        method: 'post',
        data: data
    })
}

export const setUserTeam = (data) => {
    return service({
        url: '/employees/setTeam',
        method: 'post',
        data
    })
}

// 获取用户信息
export const getUserInfo = () => {
    return service({
        url: '/users/getUserInfo',
        method: 'get'
    })
}

export const resetPassword = (data) => {
    return service({
        url: '/users/reset',
        method: 'post',
        data: data
    })
}

export const getAsyncRouter = () => {
    return service({
        url: '/users/getRoutes',
        method: 'get'
    })
}
export const getUserCount = () => {
    return service({
        url: '/users/getUserCount',
        method: 'get'
    })
}
